package com.itheima.web.controller;


import com.itheima.constant.MessageConstant;
import com.itheima.entity.Result;
import com.itheima.service.ReportService;
import org.apache.dubbo.config.annotation.Reference;
import org.aspectj.bridge.Message;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/report")
public class ReportController {

    @Reference
    private ReportService reportService;

    /**
     * 会员数量变化报表
     * @return 会员变化信息
     */
    @RequestMapping("/getMemberReport")
    public Result getMemberNumChange(){

        try {
            Map map = reportService.getMemberNumChange();
            return new Result(true, MessageConstant.GET_MEMBER_NUMBER_REPORT_SUCCESS,map);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,MessageConstant.GET_MEMBER_NUMBER_REPORT_FAIL);
        }

    }

    /**
     * 获取有关预约套餐的数据集
     * @return 套餐预约信息
     */
    @RequestMapping("/getSetmealReport")
    public Result getSetmealReport(){

        try {
            Map map = reportService.getSetmealReport();
            return new Result(true,MessageConstant.GET_SETMEAL_COUNT_REPORT_SUCCESS,map);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,MessageConstant.GET_SETMEAL_COUNT_REPORT_FAIL);
        }
    }

    /**
     * 获取运营数据
     * @return
     */
    @RequestMapping("/getBusinessReportData")
    public Result getBusinessReportData(){
        //reportDate:null, 当前日期
        //todayNewMember :0, 今日新增会员数
        //totalMember :0, 会员总数
        //thisWeekNewMember :0, 本周新增会员数
        //thisMonthNewMember :0, 本月新增会员数
        //todayOrderNumber :0, 今日预约人数
        //todayVisitsNumber :0, 今日到诊人数
        //thisWeekOrderNumber :0, 本周预约人数
        //thisWeekVisitsNumber :0, 本周到诊人数
        //thisMonthOrderNumber :0, 本月预约人数
        //thisMonthVisitsNumber :0, 本月到诊人数
        //hotSetmeal :[  热门套餐
        //      {name:'阳光爸妈升级肿瘤12项筛查（男女单人）体检套餐',setmeal_count:200,proportion:0.222},
        //      {name:'阳光爸妈升级肿瘤12项筛查体检套餐',setmeal_count:200,proportion:0.222}
        // ]


        return new Result(true,MessageConstant.GET_BUSINESS_REPORT_SUCCESS,"");
    }
}